<?php 
include '../functions.php';
p($_FILES);
if(IS_POST){
	$a = $_FILES['up']['tmp_name'];
	if(is_uploaded_file($a)){
		$type = ltrim(strrchr($_FILES['up']['name'], '.'),'.');
		$fileName = time().mt_rand(0, 9999) . '.' . $type;
		$path = './upload' . date('ymd');
		is_dir($path) || mkdir($path,0777,true);
		$fullPath = $path . '/' . $fileName;
		move_uploaded_file($a, $fullPath);
	}
}
 ?>
 <!doctype html>
 <html lang="en">
 <head>
 	<meta charset="UTF-8" />
 	<title>Document</title>
 </head>
 <body>
 	<form action="" method="post"enctype="multipart/form-data">
 		<input type="file" name="up"/>
 		<input type="submit" value="上传"/>
 	</form>
 </body>
 </html>